package cn.domob.android.ads;

import android.app.Activity;
import android.content.Context;
import android.util.AttributeSet;
import android.util.Log;
import android.view.View;
import android.view.ViewParent;
import android.view.animation.AnimationSet;
import android.widget.RelativeLayout;
import android.widget.RelativeLayout.LayoutParams;

public class DomobAdView extends RelativeLayout
{
  public static final String INLINE_SIZE_300X250 = "300x250";
  public static final String INLINE_SIZE_320X50 = "320x50";
  public static final String INLINE_SIZE_600X500 = "600x500";
  public static final String INLINE_SIZE_600X94 = "600x94";
  public static final String INLINE_SIZE_728X90 = "728x90";
  private static J p = new J(DomobAdView.class.getSimpleName());
  protected i a = null;
  protected int b;
  protected Context c;
  protected boolean d = false;
  protected boolean e = true;
  protected G f;
  protected b g;
  protected String h;
  protected int i;
  protected int j;
  protected boolean k = true;
  protected boolean l = false;
  protected boolean m = false;
  protected DomobAdListener n;
  protected DomobAdEventListener o;

  @Deprecated
  public DomobAdView(Context paramContext, AttributeSet paramAttributeSet)
  {
    this(paramContext, null, "320x50", paramAttributeSet);
  }

  public DomobAdView(Context paramContext, String paramString1, String paramString2)
  {
    this(paramContext, paramString1, paramString2, null);
  }

  private DomobAdView(Context paramContext, String paramString1, String paramString2, AttributeSet paramAttributeSet)
  {
    super(paramContext, paramAttributeSet);
    Log.i("DomobSDK", "Current SDK version is " + F.a() + " built at " + F.b());
    this.c = paramContext;
    this.f = new G(paramContext);
    this.f.setVisibility(8);
    a(paramString1);
    q.e(paramContext);
    addView(this.f);
    if (paramString2 != null);
    for (this.h = paramString2; ; this.h = null)
    {
      this.b = a.b.ordinal();
      return;
    }
  }

  public DomobAdView(Context paramContext, String paramString1, String paramString2, boolean paramBoolean)
  {
    this(paramContext, paramString1, paramString2, null);
    if ((this.a == null) || (paramBoolean))
      return;
    this.a.a(false);
    this.a.b(false);
  }

  private void m()
  {
    if ((this.a == null) || (this.a.t()))
      return;
    requestRefreshAd();
  }

  protected Context a()
  {
    return this.c;
  }

  protected void a(int paramInt1, int paramInt2)
  {
    this.i = paramInt1;
    this.j = paramInt2;
  }

  protected void a(b paramb, AnimationSet[] paramArrayOfAnimationSet)
  {
    p.b("Switch AD with/without animation.");
    this.g = paramb;
    c localc = paramb.a();
    ((Activity)this.c).runOnUiThread(new Runnable(paramArrayOfAnimationSet, localc, paramb)
    {
      public void run()
      {
        if (DomobAdView.this.f.getLayoutParams() != null)
        {
          DomobAdView.l().a("AdView's layoutParams is not null.");
          DomobAdView.this.f.getLayoutParams().width = DomobAdView.this.i;
          DomobAdView.this.f.getLayoutParams().height = DomobAdView.this.j;
          label61: if (this.a == null)
            break label355;
          DomobAdView.l().b("Show ad with animation.");
          AnimationSet localAnimationSet1 = this.a[0];
          AnimationSet localAnimationSet2 = this.a[1];
          DomobAdView.this.f.setInAnimation(localAnimationSet1);
          DomobAdView.this.f.setOutAnimation(localAnimationSet2);
          label112: DomobAdView.this.f.setVisibility(0);
          DomobAdView.this.f.addView(this.b, new RelativeLayout.LayoutParams(DomobAdView.this.i, DomobAdView.this.j));
          if (!DomobAdView.this.k)
            break label388;
          DomobAdView.this.k = false;
        }
        while (true)
        {
          if ((DomobAdView.this.f.getChildCount() >= 3) && (DomobAdView.this.f.getChildAt(0) instanceof c))
          {
            c localc = (c)DomobAdView.this.f.getChildAt(0);
            DomobAdView.this.f.removeView(localc);
            localc.a().e();
          }
          this.c.c();
          DomobAdView.this.a.a(System.currentTimeMillis());
          if (DomobAdView.this.n != null)
            DomobAdView.this.n.onReceivedFreshAd(DomobAdView.this);
          if (DomobAdView.this.o != null)
            DomobAdView.this.o.onDomobAdReturned(DomobAdView.this);
          return;
          DomobAdView.l().a("AdView's layoutParams is null.");
          DomobAdView.this.f.setLayoutParams(new RelativeLayout.LayoutParams(DomobAdView.this.i, DomobAdView.this.j));
          break label61:
          label355: DomobAdView.l().b("Show ad without animation.");
          DomobAdView.this.f.setInAnimation(null);
          DomobAdView.this.f.setOutAnimation(null);
          break label112:
          label388: DomobAdView.this.f.showNext();
        }
      }
    });
    j();
    this.a.x();
  }

  protected void a(String paramString)
  {
    this.a = new i(this, paramString);
  }

  protected boolean b()
  {
    return this.d;
  }

  protected boolean c()
  {
    return this.e;
  }

  protected int d()
  {
    return this.b;
  }

  protected DomobAdListener e()
  {
    return this.n;
  }

  protected DomobAdEventListener f()
  {
    return this.o;
  }

  protected b g()
  {
    return this.g;
  }

  protected String h()
  {
    return this.h;
  }

  protected boolean i()
  {
    for (ViewParent localViewParent = getParent(); localViewParent != null; localViewParent = localViewParent.getParent())
    {
      if (!localViewParent instanceof View)
        return true;
      if (((View)localViewParent).getVisibility() != 0)
        return false;
    }
    return true;
  }

  protected void j()
  {
    this.a.a("s", "s", 0L);
  }

  protected void k()
  {
  }

  public void loadUrl(String paramString1, String paramString2)
  {
    if (this.a != null)
    {
      this.a.a(false);
      this.a.c(true);
      this.a.j(paramString1);
      this.a.k(paramString2);
      this.a.A();
      return;
    }
    p.e("mAdController is not initialized!");
  }

  protected void onAttachedToWindow()
  {
    super.onAttachedToWindow();
    p.a("onAttachedToWindow");
    p.b("Start to load AD.");
    m();
  }

  protected void onDetachedFromWindow()
  {
    while (true)
    {
      int i2;
      try
      {
        p.a("onDetachedFromWindow");
        this.a.b();
        p.a("Clean DomobAdView.");
        int i1 = this.f.getChildCount();
        p.a(i1 + " WebView to DESTROY.");
        i2 = 0;
        if (i2 >= i1)
          break label143;
        if (this.f.getChildAt(0) instanceof c)
        {
          c localc = (c)this.f.getChildAt(0);
          if (localc != null)
          {
            this.f.removeView(localc);
            label143: localc.a().e();
          }
        }
      }
      catch (Exception localException)
      {
        p.a(localException);
        return;
        return;
      }
      finally
      {
        super.onDetachedFromWindow();
      }
      ++i2;
    }
  }

  public void onWindowFocusChanged(boolean paramBoolean)
  {
    super.onWindowFocusChanged(paramBoolean);
    p.a("onWindowFocusChanged:" + paramBoolean);
    this.e = paramBoolean;
    if (this.a != null)
    {
      if ((!this.e) || (!this.d))
        break label83;
      if (!this.a.t())
        break label75;
      this.a.d();
    }
    do
    {
      return;
      label75: this.a.h();
      label83: return;
    }
    while ((this.e) && (this.d));
    this.a.c();
  }

  protected void onWindowVisibilityChanged(int paramInt)
  {
    super.onWindowVisibilityChanged(paramInt);
    p.a("onWindowVisibilityChanged:" + paramInt);
    if (paramInt == 0);
    for (int i1 = 1; ; i1 = 0)
    {
      this.d = i1;
      return;
    }
  }

  public void requestAdForAggregationPlatform()
  {
    if (this.a != null)
    {
      this.a.a(false);
      this.a.b(false);
    }
    requestRefreshAd();
  }

  public void requestRefreshAd()
  {
    if ((this.a == null) || (!this.a.g()))
      return;
    this.a.v();
  }

  public void setAdEventListener(DomobAdEventListener paramDomobAdEventListener)
  {
    this.o = paramDomobAdEventListener;
  }

  public void setKeyword(String paramString)
  {
    this.a.b(paramString);
  }

  @Deprecated
  public void setOnAdListener(DomobAdListener paramDomobAdListener)
  {
    this.n = paramDomobAdListener;
  }

  public void setRefreshable(boolean paramBoolean)
  {
    if (this.a == null)
      return;
    this.a.a(paramBoolean);
  }

  public void setSpots(String paramString)
  {
    if (this.a == null)
      return;
    this.a.f(paramString);
  }

  public void setUserBirthdayStr(String paramString)
  {
    this.a.e(paramString);
  }

  public void setUserGender(String paramString)
  {
    this.a.d(paramString);
  }

  public void setUserPostcode(String paramString)
  {
    this.a.c(paramString);
  }

  protected static enum a
  {
    static
    {
      a[] arrayOfa = new a[4];
      arrayOfa[0] = a;
      arrayOfa[1] = b;
      arrayOfa[2] = c;
      arrayOfa[3] = d;
      e = arrayOfa;
    }
  }
}

/* Location:           C:\Users\god\Desktop\liunianjishiben_V1.1_mumayi_3745b_dex2jar.jar
 * Qualified Name:     cn.domob.android.ads.DomobAdView
 * JD-Core Version:    0.5.4
 */